import pygame
from pygame.locals import *

from Widget import *

class Text(Widget):
   """ 
      Generic text widget. 
   """
   def __init__(self, rect, text, font, fontsize):
      Widget.__init__(self)
      self.text = text
      self.rect = pygame.Rect(rect[0], rect[1], rect[2], rect[3])
      self.font = pygame.font.Font(font, fontsize)
      self.titleTextSurface = self.font.render(self.text, 1, (255,255,255))
   def draw(self):
      self.screen.blit(self.titleTextSurface, 
         (  self.parent.rect.x+self.rect.x, 
            self.parent.rect.y+self.rect.y, 
            self.rect.w, 
            self.rect.h))
      for child in self.children:
         child.draw()